combobox: Reuse code rather than reimplementing it
authorDaniel Boles <dboles@src.gnome.org>
Sat, 21 Jan 2017 15:11:40 +0000 (15:11 +0000)
committerDaniel Boles <dboles@src.gnome.org>
Sat, 21 Jan 2017 19:00:10 +0000 (19:00 +0000)
We already have cell_layout_is_sensitive() to get whether at least one
cell in a Layout is sensitive, which we need because CellLayout/View
do not implement foreach(). So, since we wrote that, we can use it to
check our CellArea too, instead of doing foreach with a custom callback.

gtk/gtkcombobox.c

index 471e419bb3167edd5c530970d863354f671b29ad..bb41e5e4c72e71fccca811373827f6808e0056b2 100644 (file)
@@ -1465,17 +1465,6 @@ cell_layout_is_sensitive (GtkCellLayout *layout)
   return sensitive;
 }
 
-static gboolean
-cell_is_sensitive (GtkCellRenderer *cell,
-                   gpointer         data)
-{
-  gboolean *sensitive = data;
-
-  g_object_get (cell, "sensitive", sensitive, NULL);
-
-  return *sensitive;
-}
-
 static gboolean
 tree_column_row_is_sensitive (GtkComboBox *combo_box,
                               GtkTreeIter *iter)
@@ -1489,20 +1478,8 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
         return FALSE;
     }
 
-  if (priv->area)
-    {
-      gboolean sensitive;
-
-      gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
-
-      sensitive = FALSE;
-
-      gtk_cell_area_foreach (priv->area, cell_is_sensitive, &sensitive);
-
-      return sensitive;
-    }
-
-  return TRUE;
+  gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
+  return cell_layout_is_sensitive (GTK_CELL_LAYOUT (priv->area));
 }
 
 static void